package com.ssh.model;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

@Component
@PropertySource(value= {"classpath:person.properties"})//选择从哪个配置文件中拿值
@ConfigurationProperties(prefix="person")//默认从全局配置文件中获取值
//@Validated//jsr303数据校验
public class Person {
	//@Email//邮箱校验
	private String name;
	@Value("#{11*2}")//优先级小于配置文件中的值，即@Value小于@ConfigurationProperties
	private int age;
	private Map<String, Object> map;
	private List<Integer> list;
	private Student student;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name; 
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public Map<String, Object> getMap() {
		return map;
	}
	public void setMap(Map<String, Object> map) {
		this.map = map;
	}
	public List<Integer> getList() {
		return list;
	}
	public void setList(List<Integer> list) {
		this.list = list;
	}
	public Student getStudent() {
		return student;
	}
	public void setStudent(Student student) {
		this.student = student;
	}
	@Override
	public String toString() {
		return "Person [name=" + name + ", age=" + age + ", map=" + map + ", list=" + list + ", student=" + student
				+ "]";
	}
	
}
